package org.jeecg.modules.dock.handler.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.modules.basic.material.entity.BasicMaterial;
import org.jeecg.modules.basic.material.service.IBasicMaterialService;
import org.jeecg.modules.basic.plant.service.IWmsSapWarehouseMapService;
import org.jeecg.modules.basic.unit.service.IBasicUnitService;
import org.jeecg.modules.business.outbound.entity.WmsOutReceiptTaskMaterial;
import org.jeecg.modules.business.outbound.vo.WmsOutReceiptTaskPage;
import org.jeecg.modules.business.warehouse.entity.WmsInReceiptTaskMaterial;
import org.jeecg.modules.business.warehouse.entity.vo.WmsInReceiptTaskPage;
import org.jeecg.modules.dock.constant.SystemConstants;
import org.jeecg.modules.dock.entity.DockDataReceiveRecord;
import org.jeecg.modules.dock.entity.dto.request.OriginalVolumeUbOrderRequestDTO;
import org.jeecg.modules.dock.entity.dto.response.SapBaseResponseDTO;
import org.jeecg.modules.dock.enums.DirectionOfInventoryEnum;
import org.jeecg.modules.dock.enums.DockDataStatus;
import org.jeecg.modules.dock.enums.ReceiptsEnum;
import org.jeecg.modules.dock.enums.SapInterfaceTypeEnum;
import org.jeecg.modules.dock.handler.AbstractSapDataHandler;
import org.jeecg.modules.flow.sys.entity.dto.BaseFlowDto;
import org.jeecg.modules.flow.sys.service.WorkFlowService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 原卷UB单发货handler
 *
 * @author zhoutong
 */
@Component
@Slf4j
@RequiredArgsConstructor
public class OriginalVolumeUbOrderHandler extends AbstractSapDataHandler<OriginalVolumeUbOrderRequestDTO> {

    private final WorkFlowService workFlowService;
    private final IBasicMaterialService materialService;
    private final IWmsSapWarehouseMapService wmsSapWarehouseMapService;
    private final IBasicUnitService iBasicUnitService;
    private final SapCommonService sapCommonService;
    private static final String WAREHOUSE_DOCUMENT_IN_CODE = "rkrw_rule";
    private static final String WAREHOUSE_DOCUMENT_OUT_CODE = "ckrw_rule";
    private static final String WAREHOUSE_PARAM = "{\"prefix\":\"RKRW\"}";
    private static final String OUTBOUND_DOCUMENT_TASK = "";
    private static final String OUTBOUND_BUSINESS_TYPE = "";
    private static final String OUTBOUND_CODE = "";
    private static final String OUTBOUND_DOCUMENT_CODE = "";
    private static final String OUTBOUND_PARAM = "";
    private static final String SAP_REQUEST_PERSON = "SAP请求人员";
    private static final String FOUR = "4";
    private static final String S = "S";
    private static final String E = "E";
    @Value(value = "${wms.config.personnel.sap:}")
    private String personnelSap;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public synchronized List<? extends SapBaseResponseDTO> doHandle(List<OriginalVolumeUbOrderRequestDTO> data) {
        List<SapBaseResponseDTO> dtoList = new ArrayList<>();
        SapBaseResponseDTO responseDTO = new SapBaseResponseDTO();
        log.info("收到原卷UB单发货:{},\n共{}条", data, data.size());
        /*
            2023-10-30
            由于逻辑需要覆盖一二三四期业务，每次接受数据要生成出库和入库任务
            首先生成出库任务：
                把data数据进行分组，分组依据参数为出发库位,
                根据得到的分组结果，去遍历匹配wms_sap_warehouse_map表中是否已经配置仓库
                把得到的匹配结果分别进行创建出库任务（能找到配置仓库就生成，否则弃用），这样能保证多库位多批量数据过来后，同一出发库位的数据能挂载一个出库任务下；
            其次生成入库任务：
                把data数据进行分组，分组依据参数为接收库位
                根据得到的分组结果，去遍历匹配wms_sap_warehouse_map表中是否已经配置仓库
                把得到的分组结果分别进行创建入库任务（能找到配置仓库就生成，否则弃用），这样能保证多库位多批量数据过来后，同一接收库位的数据能挂载一个入库任务下；
            这样可能会生成多个出库和入库任务，但是逻辑覆盖了一二三四期，最终进行方法的性能优化和逻辑抽象。
         */
        if (CollectionUtil.isNotEmpty(data)) {

            List<String> materialCodes = data.stream().map(t -> t.getMaterialCode()).collect(Collectors.toList());
            sapCommonService.verifyExistenceMaterialCode(materialCodes);

            //出库任务处理: data分组 出发库位
            Map<String, List<OriginalVolumeUbOrderRequestDTO>> outCollect = data.stream().collect(Collectors.groupingBy(OriginalVolumeUbOrderRequestDTO::getFromStore));
            log.info("出库任务分组结果: {}", outCollect);
            Set<String> outKey = outCollect.keySet();
            for (int i = 0; i < outKey.size(); i++) {
                String sapLocation = outKey.iterator().next();
                List<OriginalVolumeUbOrderRequestDTO> outList = outCollect.get(sapLocation);
                List<WmsOutReceiptTaskMaterial> outMaterialList = new ArrayList<>();
                Map<String, String> unitIdMap = new HashMap<>();
                if (CollectionUtil.isNotEmpty(outList)) {
                    List<String> codes = outList.stream().map(t -> t.getUnit()).collect(Collectors.toList());
                    unitIdMap = iBasicUnitService.getIdByCodes(codes);
                }


                for (OriginalVolumeUbOrderRequestDTO dto : outList) {
                    WmsOutReceiptTaskMaterial outMaterial = new WmsOutReceiptTaskMaterial();
                    outMaterial.setOriginalSystemNumber(dto.getUbOrderNumber());
                    outMaterial.setOriginalSystemLineNumber(dto.getUbLineProject().toString());
                    outMaterial.setBatchCode(dto.getBatchCode());
                    outMaterial.setSteelCoilNumber(dto.getSteelCoilNumber());
                    outMaterial.setRemark(dto.getRemark());
                    if (ObjectUtil.isNotNull(dto.getQuantity())) {
                        outMaterial.setPlanQuantity(dto.getQuantity());
                    }
                    if (ObjectUtil.isNotEmpty(unitIdMap.get(dto.getUnit()))) {
                        outMaterial.setWmsBasicUnitId(unitIdMap.get(dto.getUnit()));
                    }
                    outMaterial.setWidth(dto.getSteelWidth());
                    outMaterial.setLength(dto.getSteellength());
                    outMaterial.setThickness(dto.getUnitThickness());
                    // 辅数量按照产品要求默认为1
//                        outMaterial.setAssistQuantity(BigDecimal.ONE);
                    outMaterial.setExtraText(JSON.toJSONString(dto));

                    // 根据物料code查询物料信息
                    List<BasicMaterial> basicMaterials = materialService.listByCode(dto.getMaterialCode());
                    // 根据仓库code查询仓库ID
                    String wmsBasicWarehouseId = wmsSapWarehouseMapService.getWmsStroeBySapStore(dto.getFromStore(),dto.getFactory());
                    outMaterial.setWmsBasicWarehouseId(wmsBasicWarehouseId);
                    if (wmsBasicWarehouseId == null){
                        outMaterial.setSapLocationFactory(dto.getFromStore()+"-"+dto.getFactory());
                        outMaterial.setWmsBasicWarehouseId("");
                    }
                    if (ObjectUtil.isNotEmpty(basicMaterials)) {
                        BasicMaterial basicMaterial = basicMaterials.get(0);
                        outMaterial.setWmsBasicMaterialId(basicMaterial.getId());
                        if (StringUtils.isNotEmpty(basicMaterial.getAssistantUnitId())) {
                            outMaterial.setUnitAssistId(basicMaterial.getAssistantUnitId());
                            outMaterial.setAssistQuantity(BigDecimal.ONE);
                        }
                    }

                    outMaterialList.add(outMaterial);
                }
                WmsOutReceiptTaskPage wmsOutReceiptTaskPage = new WmsOutReceiptTaskPage();
                wmsOutReceiptTaskPage.setDocumentType(ReceiptsEnum.C41.getCode());
                wmsOutReceiptTaskPage.setOrganization("A04A01");
                wmsOutReceiptTaskPage.setSysOrgCode("A04A01");
                wmsOutReceiptTaskPage.setOwnerType("1");
                wmsOutReceiptTaskPage.setWmsOutReceiptTaskMaterialList(outMaterialList);
                wmsOutReceiptTaskPage.setDocumentCode(FillRuleUtil.executeRule(DirectionOfInventoryEnum.OUTBOUND.getCode(), JSON.parseObject(DirectionOfInventoryEnum.OUTBOUND.getRemark())).toString());
                wmsOutReceiptTaskPage.setTaskDate(new Date());
                wmsOutReceiptTaskPage.setOriginalSystem(SystemConstants.SAP);
                wmsOutReceiptTaskPage.setRequestTime(DateUtil.now());
                wmsOutReceiptTaskPage.setRequestPerson(DirectionOfInventoryEnum.OUTBOUND.getSource());
                wmsOutReceiptTaskPage.setCreateBy(personnelSap);

                String factory = outList.stream().map(t -> t.getFactory()).distinct().collect(Collectors.joining(","));
                wmsOutReceiptTaskPage.setOwner(factory);

                if (CollectionUtil.isNotEmpty(wmsOutReceiptTaskPage.getWmsOutReceiptTaskMaterialList())) {
                    WmsOutReceiptTaskMaterial taskMaterial = wmsOutReceiptTaskPage.getWmsOutReceiptTaskMaterialList().get(0);
                    wmsOutReceiptTaskPage.setOriginalSystemNumber(taskMaterial.getOriginalSystemNumber());
                }
                BaseFlowDto outFlow = new BaseFlowDto();
                outFlow.setBusinessType(ReceiptsEnum.C41.getType());
                outFlow.setDocumentType(ReceiptsEnum.C41.getCode());
                outFlow.setCode(ReceiptsEnum.C41.getRemark());
                outFlow.setData(wmsOutReceiptTaskPage);
                try {
                    workFlowService.commit(outFlow);
                    responseDTO.setResult(DockDataStatus.SUCCESS.getCode());
                    responseDTO.setUuid(data.get(0).getUuid());
                } catch (Exception e) {
                    responseDTO.setResult(DockDataStatus.FAILURE.getCode());
                    responseDTO.setUuid(data.get(0).getUuid());
                    responseDTO.setMessage("生成原卷UB单发货出库任务异常");
                    log.error("原卷UB单发货出库任务: {}", e.toString());
                }
//                }
                log.info("sap库位为: {}" + "的出库任务已创建", sapLocation);
            }

            //入库任务处理: data分组 接收库位
            Map<String, List<OriginalVolumeUbOrderRequestDTO>> inCollect = data.stream().collect(Collectors.groupingBy(OriginalVolumeUbOrderRequestDTO::getToStore));
            log.info("入库任务分组结果: {}", inCollect);
            Set<String> inKey = inCollect.keySet();
            for (int j = 0; j < inKey.size(); j++) {
                String sapLocation = inKey.iterator().next();
                List<OriginalVolumeUbOrderRequestDTO> inList = inCollect.get(sapLocation);
//                //匹配配置仓库
//                List<WmsSapWarehouseMap> sapWarehouseMaps = wmsSapWarehouseMapService.list(new LambdaQueryWrapper<WmsSapWarehouseMap>().eq(WmsSapWarehouseMap::getSapLocation, sapLocation).eq(WmsSapWarehouseMap::getState, "1"));
//                if (ObjectUtil.isNotEmpty(sapWarehouseMaps)) {
                    List<WmsInReceiptTaskMaterial> inMateriallist = new ArrayList<>();

                    Map<String, String> unitIdMap = new HashMap<>();
                    if (CollectionUtil.isNotEmpty(inList)) {
                        List<String> codes = inList.stream().map(t -> t.getUnit()).collect(Collectors.toList());
                        unitIdMap = iBasicUnitService.getIdByCodes(codes);
                    }
                    for (OriginalVolumeUbOrderRequestDTO dto : inList) {
                        WmsInReceiptTaskMaterial material = new WmsInReceiptTaskMaterial();
                        // 给入库单物料信息赋值
                        material.setOriginalSystemNumber(dto.getUbOrderNumber());
                        material.setOriginalSystemLineNumber(dto.getUbLineProject().toString());
                        material.setBatchCode(dto.getBatchCode());
                        material.setSteelCoilNumber(dto.getSteelCoilNumber());
                        material.setRemark(dto.getRemark());
                        material.setFactory(dto.getFactory());
//                        material.setPlanQuantity(BigDecimal.ONE);
                        if (ObjectUtil.isNotNull(dto.getQuantity())) {
                            material.setPlanQuantity(dto.getQuantity());
                        }
                        if (ObjectUtil.isNotEmpty(unitIdMap.get(dto.getUnit()))) {
                            material.setWmsBasicUnitId(unitIdMap.get(dto.getUnit()));
                        }
                        material.setWidth(dto.getSteelWidth());
                        material.setLength(dto.getSteellength());
                        material.setThickness(dto.getUnitThickness());
                        material.setExtraText(JSON.toJSONString(dto));
                        // 根据物料code查询物料信息
                        List<BasicMaterial> basicMaterials = materialService.listByCode(dto.getMaterialCode());
                        // 根据仓库code查询仓库ID
                        String wmsBasicWarehouseId = wmsSapWarehouseMapService.getWmsStroeBySapStore(dto.getToStore(),dto.getFactory());
                        material.setWmsBasicWarehouseId(wmsBasicWarehouseId);
                        if (wmsBasicWarehouseId == null){
                            material.setSapLocationFactory(dto.getToStore()+"-"+dto.getFactory());
                            material.setWmsBasicWarehouseId("");
                        }
                        material.setSapLocation(dto.getToStore());
                        if (CollectionUtil.isNotEmpty(basicMaterials)) {
                            BasicMaterial basicMaterial = basicMaterials.get(0);
                            material.setWmsBasicMaterialId(basicMaterial.getId());
                            if (StringUtils.isNotEmpty(basicMaterial.getAssistantUnitId())) {
                                material.setUnitAssistId(basicMaterial.getAssistantUnitId());
                                material.setAssistQuantity(BigDecimal.ONE);
                            }
                        }
                        inMateriallist.add(material);
                    }
                    WmsInReceiptTaskPage wmsInReceiptTaskPage = new WmsInReceiptTaskPage();
                    wmsInReceiptTaskPage.setDocumentType(ReceiptsEnum.R02.getCode());
                    wmsInReceiptTaskPage.setOwnerType("1");
                    wmsInReceiptTaskPage.setOrganization("A04A01");
                    wmsInReceiptTaskPage.setSysOrgCode("A04A01");

                    String factory = inList.stream().map(t -> t.getFactory()).distinct().collect(Collectors.joining(","));
                    wmsInReceiptTaskPage.setOwner(factory);

                    wmsInReceiptTaskPage.setDocumentCode(FillRuleUtil.executeRule(WAREHOUSE_DOCUMENT_IN_CODE, JSON.parseObject(WAREHOUSE_PARAM)).toString());
                    wmsInReceiptTaskPage.setWmsInReceiptTaskMaterialList(inMateriallist);
                    wmsInReceiptTaskPage.setOriginalSystem(SystemConstants.SAP);
                    wmsInReceiptTaskPage.setRequestTime(new Date());
                    wmsInReceiptTaskPage.setRequestPerson(SAP_REQUEST_PERSON);
                    wmsInReceiptTaskPage.setCreateBy(personnelSap);

                    if (CollectionUtil.isNotEmpty(wmsInReceiptTaskPage.getWmsInReceiptTaskMaterialList())) {
                        WmsInReceiptTaskMaterial taskMaterial = wmsInReceiptTaskPage.getWmsInReceiptTaskMaterialList().get(0);
                        wmsInReceiptTaskPage.setOriginalSystemNumber(taskMaterial.getOriginalSystemNumber());
                    }
                    wmsInReceiptTaskPage.setTaskDate(DateUtil.parseDate(DateUtil.now()));
                    BaseFlowDto baseFlowDto = new BaseFlowDto();
                    baseFlowDto.setBusinessType(ReceiptsEnum.R02.getType());
                    baseFlowDto.setDocumentType(ReceiptsEnum.R02.getCode());
                    baseFlowDto.setCode(ReceiptsEnum.R02.getRemark());
                    baseFlowDto.setData(wmsInReceiptTaskPage);
                    try {
                        workFlowService.commit(baseFlowDto);
                        responseDTO.setResult(DockDataStatus.SUCCESS.getCode());
                        responseDTO.setUuid(data.get(0).getUuid());
                    } catch (Exception e) {
                        responseDTO.setResult(DockDataStatus.FAILURE.getCode());
                        responseDTO.setUuid(data.get(0).getUuid());
                        responseDTO.setMessage("生成原卷UB单发货入库任务异常");
                        log.error("原卷UB单发货入库任务: {}", e.toString());
                    }
//                }
                log.info("sap库位为: {}" + "的入库任务已创建", sapLocation);
            }
            dtoList.add(responseDTO);
        }
        return dtoList;
    }

    /**
     * 给入库任务赋值
     *
     * @param dto
     * @return
     */
    @NotNull
    private WmsInReceiptTaskMaterial setWarehouse(OriginalVolumeUbOrderRequestDTO dto) {
        WmsInReceiptTaskMaterial material = new WmsInReceiptTaskMaterial();
        material.setOriginalSystemNumber(dto.getUbOrderNumber());
        material.setOriginalSystemLineNumber(dto.getUbLineProject().toString());
        material.setBatchCode(dto.getBatchCode());
        material.setSteelCoilNumber(dto.getSteelCoilNumber());
        material.setRemark(dto.getRemark());
        material.setPlanQuantity(dto.getQuantity());
        material.setExtraText(JSON.toJSONString(dto));
        List<BasicMaterial> basicMaterials = materialService.listByCode(dto.getMaterialCode());
        if (CollectionUtil.isNotEmpty(basicMaterials)) {
            BasicMaterial basicMaterial = basicMaterials.get(0);
            material.setWmsBasicMaterialId(basicMaterial.getId());
        }
        return material;
    }

    /**
     * 给出库任务赋值
     *
     * @param dto
     * @return
     */
    @NotNull
    private WmsOutReceiptTaskMaterial setOutbound(OriginalVolumeUbOrderRequestDTO dto) {
        WmsOutReceiptTaskMaterial material = new WmsOutReceiptTaskMaterial();
        material.setOriginalSystemNumber(dto.getUbOrderNumber());
        material.setOriginalSystemLineNumber(dto.getUbLineProject().toString());
        material.setBatchCode(dto.getBatchCode());
        material.setSteelCoilNumber(dto.getSteelCoilNumber());
        material.setRemark(dto.getRemark());
        material.setPlanQuantity(dto.getQuantity());
        material.setExtraText(JSON.toJSONString(dto));
        List<BasicMaterial> basicMaterials = materialService.listByCode(dto.getMaterialCode());
        if (CollectionUtil.isNotEmpty(basicMaterials)) {
            BasicMaterial basicMaterial = basicMaterials.get(0);
            material.setWmsBasicMaterialId(basicMaterial.getId());
        }
        return material;
    }

    /**
     * 生产一个入库任务流程实体
     *
     * @param wmsInReceiptTaskPage
     * @return
     */
    @NotNull
    private static BaseFlowDto getWarehouseBaseFlowDto(WmsInReceiptTaskPage wmsInReceiptTaskPage) {
        BaseFlowDto warehouseBaseFlowDto = new BaseFlowDto();
        warehouseBaseFlowDto.setBusinessType(ReceiptsEnum.R02.getType());
        warehouseBaseFlowDto.setDocumentType(ReceiptsEnum.R02.getCode());
        warehouseBaseFlowDto.setCode(ReceiptsEnum.R02.getRemark());
        warehouseBaseFlowDto.setData(wmsInReceiptTaskPage);
        return warehouseBaseFlowDto;
    }

    /**
     * 生产一个出库任务流程实体
     *
     * @param wmsOutReceiptTaskPage
     * @return
     */
    @NotNull
    private static BaseFlowDto getOutboundBaseFlowDto(WmsOutReceiptTaskPage wmsOutReceiptTaskPage) {
        BaseFlowDto outboundBaseFlowDto = new BaseFlowDto();
        outboundBaseFlowDto.setBusinessType(OUTBOUND_BUSINESS_TYPE);
        outboundBaseFlowDto.setDocumentType(OUTBOUND_DOCUMENT_TASK);
        outboundBaseFlowDto.setCode(OUTBOUND_CODE);
        outboundBaseFlowDto.setData(wmsOutReceiptTaskPage);
        return outboundBaseFlowDto;
    }

    /**
     * 生产一个入库任务
     *
     * @param warehouseList
     * @return
     */
    @NotNull
    private static WmsInReceiptTaskPage getWmsInReceiptTaskPage(List<WmsInReceiptTaskMaterial> warehouseList) {
        WmsInReceiptTaskPage wmsInReceiptTaskPage = new WmsInReceiptTaskPage();
        wmsInReceiptTaskPage.setDocumentType(ReceiptsEnum.R02.getCode());
        wmsInReceiptTaskPage.setOwnerType("1");
        wmsInReceiptTaskPage.setOrganization("A04A01");
        wmsInReceiptTaskPage.setSysOrgCode("A04A01");
        wmsInReceiptTaskPage.setOwner("A05");
        wmsInReceiptTaskPage.setDocumentCode(FillRuleUtil.executeRule(WAREHOUSE_DOCUMENT_IN_CODE, JSON.parseObject(WAREHOUSE_PARAM)).toString());
        wmsInReceiptTaskPage.setWmsInReceiptTaskMaterialList(warehouseList);
        wmsInReceiptTaskPage.setOriginalSystem(SystemConstants.SAP);
        wmsInReceiptTaskPage.setRequestTime(new Date());
        wmsInReceiptTaskPage.setRequestPerson(SAP_REQUEST_PERSON);
        wmsInReceiptTaskPage.setTaskDate(DateUtil.parseDate(DateUtil.now()));
        return wmsInReceiptTaskPage;
    }

    /**
     * 生产一个出库任务
     *
     * @param outboundList
     * @return
     */
    @NotNull
    private static WmsOutReceiptTaskPage getWmsOutReceiptTaskPage(List<WmsOutReceiptTaskMaterial> outboundList) {
        WmsOutReceiptTaskPage wmsOutReceiptTaskPage = new WmsOutReceiptTaskPage();
        wmsOutReceiptTaskPage.setDocumentType(OUTBOUND_DOCUMENT_TASK);
        wmsOutReceiptTaskPage.setOwnerType("1");
        wmsOutReceiptTaskPage.setOrganization("A04A01");
        wmsOutReceiptTaskPage.setSysOrgCode("A04A01");
        wmsOutReceiptTaskPage.setOwner("A05");
        wmsOutReceiptTaskPage.setDocumentCode(FillRuleUtil.executeRule(OUTBOUND_DOCUMENT_CODE, JSON.parseObject(OUTBOUND_PARAM)).toString());
        wmsOutReceiptTaskPage.setWmsOutReceiptTaskMaterialList(outboundList);
        wmsOutReceiptTaskPage.setTaskDate(DateUtil.parseDate(DateUtil.now()));
        return wmsOutReceiptTaskPage;
    }

    @Override
    public SapInterfaceTypeEnum type() {
        return SapInterfaceTypeEnum.MATERIAL_UB_SEND;
    }

    /**
     * 接收sap信息，并记录日志
     *
     * @param data
     * @return
     */
    private DockDataReceiveRecord getRecord(String data) {
        DockDataReceiveRecord dockDataReceiveRecord = new DockDataReceiveRecord();
        dockDataReceiveRecord.setUuid(IdUtil.fastSimpleUUID());
        dockDataReceiveRecord.setSource(SystemConstants.SAP);
        dockDataReceiveRecord.setTarget(SystemConstants.WMS);
//        dockDataReceiveRecord.setBusinessCode(business);
        dockDataReceiveRecord.setData(data);
        dockDataReceiveRecord.setReceiveTime(new Date());
        dockDataReceiveRecord.setStatus(DockDataStatus.SUCCESS);
        dockDataReceiveRecord.setResultCode(E);
        dockDataReceiveRecord.setResultData("没有对应仓库信息");
        return dockDataReceiveRecord;
    }

}
